﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using AppDateService.Contract;
using AppDateService.Contract.Request;
using AppDateService.Contract.Response;
using System.IO;

namespace AppDateService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IAppDateService" in both code and config file together.
    [ServiceContract]
    public interface IAppDateService
    {
        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "getOccupations")]
        IEnumerable<COccupation> GetOccupations();

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "getInterests")]
        IEnumerable<CInterest> GetInterests();

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "getLocations")]
        IEnumerable<CLocation> GetLocations();

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "getFavorites/{token}/{nonce}/{userId}")]
        ResponseGetFavorites GetFavorites(string token, string nonce, string userId);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "setFavorite/{token}/{nonce}/{favoriteUserId}")]
        ResponseSetFavorite SetFavorite(string token, string nonce, string favoriteUserId);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "getNewMessages/{token}/{nonce}/{dateId}/{lastMessageId}")]
        ResponseNewMessages GetNewMessages(string token, string nonce, string dateId, string lastMessageId);

        [OperationContract]
        [WebInvoke(Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "loginAccount")]
        ResponseLoginAccount LoginAccount(RequestLoginAccount user);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "checkLoginAccount/{username}/{password}")]
        ResponseLoginAccount CheckLoginAccount(string username, string password);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "existsUserName/{username}")]
        bool ExistsUsername(string username);

        [OperationContract]
        [WebInvoke(Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "registerAccount")]
        string RegisterAccount(RequestRegisterAccount account);

        [OperationContract]
        [WebInvoke(Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "editAccount")]
        ResponseEditAccount EditAccount(RequestEditAccount message);

        [OperationContract]
        [WebInvoke(Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "sendMessage")]
        ResponseSendMessage SendMessage(RequestSendMessage message);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "statusPendingDate/{token}/{nonce}/{userId}")]
        ResponseRequestDate StatusPendingDate(string token, string nonce, string userId);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "requestDate/{token}/{nonce}/{userId}")]
        ResponseRequestDate RequestDate(string token, string nonce, string userId);

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "cancelDate/{token}/{nonce}/{dateId}")]
        ResponseCancelDate CancelDate(string token, string nonce, string dateId);

        [OperationContract]
        [WebInvoke(Method = "GET",            
            UriTemplate = "getUserImage/{token}/{nonce}/{userId}")]
        Stream GetUserImage(string token, string nonce, string userId);

        [OperationContract]
        [WebInvoke(Method = "GET",
            UriTemplate = "getMessageImage/{token}/{nonce}/{dateId}/{messageId}")]
        Stream GetMessageImage(string token, string nonce, string dateId, string messageId);

        [OperationContract]
        [WebInvoke(
            Method = "POST",
            BodyStyle = WebMessageBodyStyle.Wrapped,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "userImages")]
        ResponseUploadUserImage UploadUserImage(Stream uploadFile);

        [OperationContract]
        [WebInvoke(Method = "POST",
            BodyStyle = WebMessageBodyStyle.Wrapped,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "msgImages")]
        ResponseUploadMessageImage UploadMessageImage(Stream uploadFile);
    }
}
